package com.hx.vending.dao;

import com.hx.vending.bean.OnlineOrder;
import com.hx.vending.bean.entity.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/12/5.
 */
@Repository
public interface OnlineOrderMapper {

    List<Map<String,Object>> selectOnlineOrderAmountByFieldId(@Param("fieldList") List<Integer> fieldList, @Param("startTime")String startTime,
                                                              @Param("endTime")String endTime,@Param("userId")Integer userId);

    List<Map<String,Object>> selectUnderOrderByField(@Param("fieldList") List<Integer> fieldList, @Param("startTime")String startTime,
                                                     @Param("endTime")String endTime,@Param("userId")Integer userId);

    Map<String,Object> selectOnlineOrderAmount(@Param("startTime")String startTime, @Param("endTime")String endTime,
                                                     @Param("userId")Integer userId);

    Double selectSumOnlineOrderNumber(@Param("userId") Integer userId, @Param("fieldList") List<Integer> fieldList,
                                       @Param("startTime") String startTime, @Param("endTime") String endTime);

    Double selectUnderLineByUserId(@Param("userId") Integer userId,@Param("startTime") String startTime,
                                   @Param("endTime") String endTime,@Param("fieldList") List<Integer> fieldList);

    List<OnlineOrder> selectByUserId(@Param("userId") Integer userId, @Param("startTime") String startTime,
                                     @Param("endTime") String endTime,@Param("integers") Integer[] integers);

    int selectCountPeople(@Param("userId")Integer userId, @Param("startTime") String startTime,
                          @Param("endTime") String endTime,@Param("integers") Integer[] integers);

    Double selectCountMoney(@Param("userId")Integer userId, @Param("startTime") String startTime,
                             @Param("endTime") String endTime,@Param("integers") Integer[] integers);

    List<OnlineOrderVo> getOnlineOrderVoList(Map<String, Object> paramMap);

    List<OnlineOrderVo> getOnlineOrderList(Map<String, Object> paramMap);

    List<OnlineOrder> selectUnderlineByUserTime(@Param("userId")Integer userId,@Param("startTime") String startTime,
                                                @Param("endTime")String endTime);

    Double selectUnderCountMoney(@Param("userId")Integer userId,@Param("startTime")String startTime,@Param("endTime")String endTime);

    Integer selectUnderCountPeople(@Param("userId")Integer userId,@Param("startTime")String startTime,@Param("endTime")String endTime);

    List<UnderlineOrderVo> getUnderlineOrderList(Map<String,Object> paramMap);

    List<Map<String,Object>> selectOrderOnlineAmountByTime(@Param("userId")Integer userId,@Param("startTime") String startTime,
                                                           @Param("endTime") String endTime,@Param("integers") Integer[] integers);
    List<Map<String,Object>> selectUnderOrderAmountByTime(@Param("userId")Integer userId,@Param("startTime") String startTime,
                                                          @Param("endTime") String endTime,@Param("integers") Integer[] integers);
    /**
     * 插入订单信息
     * @param record
     * @return
     */
    int insertSelective(OnlineOrder record);

   Double selectByEquipment(@Param("equipmentId")String equipmentId,@Param("userId")Integer userId,
                            @Param("startTime")String startTime, @Param("endTime")String endTime);

   List<UnderlineOrderVo> selectUnlineByEquipment(Map map);

   Double selectUnderByEquipment(@Param("equipmentId")String equipmentId,@Param("userId")Integer userId,
                                 @Param("startTime")String startTime, @Param("endTime")String endTime);

    OnlineOrder selectByPrimaryKeySelective(OnlineOrder record);

    int updateByPrimaryKeySelective(OnlineOrder record);

    List<OnlineOrder> selectByEquipmentTime(@Param("userId")Integer userId,@Param("equipmentId")String equipmentId,
                                            @Param("startTime")String startTime, @Param("endTime")String endTime,
                                            @Param("pageStart")Integer pageStart);

    List<OnlineOrder> selectByExample(OnlineOrder onlineOrder);

    List<OnlineOrderVo> getOnlineByEquipment(Map map);

    List<Map<String, Object>> getAmountByFieldId(@Param("fieldId") Integer fieldId,@Param("startTime") String startTime,
                                                 @Param("endTime") String endTime);

    List<Map<String, Object>> selectUnderAmountByEquipmentId(@Param("fieldId") Integer fieldId,@Param("startTime") String startTime,
                                                             @Param("endTime") String endTime);

    List<OnlineOrderRanking> selectOnlineOrderRanking(@Param("startTime")String startTime, @Param("endTime")String endTime);

    OnlineOrderEquipment selectOnlineOrderEquipment(@Param("onlineOrderId")Integer onlineOrderId);

    List<OnlineOrder> selectByPayOverTime(OnlineOrder record);

    int deleteByPrivate(Integer onlineOrderId);

    List<OnlineOrder> selectByFieldTime(@Param("userId") Integer userId,@Param("integers")Integer[] integers,
                                        @Param("startTime") String startTime,@Param("endTime") String endTime,
                                        @Param("pageStart") Integer pageStart);

    List<GoodsOrderVO> selectOrderByEquipment(@Param("equipmentId") String equipmentId, @Param("pageNum") int pageNum,
                                              @Param("limit") int limit);

    Map<String,Object> selectUnderOrder(@Param("startTime") String startTime,@Param("endTime")String endTime,
                                        @Param("userId") Integer userId);
}
